package com.cs.pk.form.dialog;



import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TreeItem;

import com.cs.pk.clearcase.interfaces.ControlInterface;

public class InformationControl implements ControlInterface {
	
	private String labels[] = null;
	private Image icons[] = null;
	Composite infoControl = null;
	public InformationControl(String infos[],Image images[]){
		labels=infos;
		icons = images;
	}
	
//	public void createInfoControl(Composite parent){
//		infoControl = new Composite(parent,SWT.NONE);
//		infoControl.setLayout(new GridLayout(2,false));
//		GridData data = new GridData(SWT.BEGINNING,SWT.TOP,true,true,1,1);
//		infoControl.setLayoutData(data);
//		for (int i = 0; i < labels.length; i++) {
//			if(icons!=null  ){
//				if(icons[i]!=null){
//			     Label b =  new Label(infoControl,SWT.NONE);
//			     b.setImage(icons[i]);
//				}
//			}
//			new Label(infoControl,SWT.NONE).setText(labels[i]);
//			
//		}
//		
//	}
	
	public static ControlInterface getNewInstance(String infos[],Image images[]){
	    return new InformationControl(infos, images);
	}
	
	public void dispose(){
		infoControl.dispose();
	}
	
	public void setVisible(boolean visible){
		GridData data = (GridData)infoControl.getLayoutData();
		data.exclude = !visible;
		infoControl.setVisible(visible);
		infoControl.layout();
	}

	public void fillValues() {
	    
	}

	public void openForm(Composite composite, TreeItem item) {
	    infoControl = new Composite(composite,SWT.NONE);
		infoControl.setLayout(new GridLayout(2,false));
		GridData data = new GridData(SWT.BEGINNING,SWT.TOP,true,true,1,1);
		infoControl.setLayoutData(data);
		for (int i = 0; i < labels.length; i++) {
			if(icons!=null  ){
				if(icons[i]!=null){
			     Label b =  new Label(infoControl,SWT.NONE);
			     b.setImage(icons[i]);
				}
			}
			new Label(infoControl,SWT.NONE).setText(labels[i]);
			
		}
	}

	public void discardChanges() {
	    
	}

	public boolean save() {
	    return false;
	}

	public void saveChanges() {
	    
	}

	public void removeOld() {
	    
	}

	public void repaint() {
	    
	}

}
